Write a custom CUDA kernel to optimize `Sb-PiPLU` with a trainable parameter `k`.

Formula:
  f(x) = 2*softsign(x) + softsign(x)^2   if x <= 0
       = x                                if 0 < x <= k
       = x / k                            if x > k
where `k` is a learnable nn.Parameter.

Problem Analysis:
1. Memory Bound & Computationally Heavy: The operation is element-wise but involves multiple branches and arithmetic operations.
2. Operator Chaining: PyTorch implementation requires multiple `torch.where` calls.
3. Trainable Parameter: The kernel must accept `k` as a scalar input that is determined at runtime from the `nn.Parameter`.

Optimization Strategy: Fused Element-wise Kernel with Vectorization

1. One-Thread-per-Element: Map each element to a CUDA thread.

2. Vectorized Loads (float4): Use `float4` to process 128 bits per memory transaction.

3. Fused Branching Logic:
   - The scalar parameter `k` and `1/k` are passed to the kernel.
   - Kernel logic uses a nested `if-else` to handle the three segments.

4. One-Pass: Fuse all steps into a single read-compute-write kernel.
  
Here's an example to show you the syntax of inline embedding custom CUDA operators in torch: The example given architecture is:   
  
```python
import torch
import torch.nn as nn
import torch.nn.functional as F

BATCH_SIZE = 4096
HIDDEN_DIM = 4096
SHAPE = (BATCH_SIZE, HIDDEN_DIM)

# Sb-PiPLU 初始参数 k
K_INIT = 21.0

class SbPiPLU(nn.Module):
    '''
    Sb-PiPLU: A Novel Parametric Activation Function for Deep Learning
    DOI:10.1109/ACCESS.2025.3561464
    Formula:
      f(x) = 2*softsign(x) + softsign(x)^2    if x <= 0
           = x                                if 0 < x <= k
           = x / k                            if x > k
    '''
    def __init__(self, k_init=21.0):
        super(SbPiPLU, self).__init__()
        self.k = nn.Parameter(torch.tensor(k_init))

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        softsign_x = F.softsign(x)
        
        part1 = 2 * softsign_x + softsign_x.pow(2)
        part2 = x
        part3 = x / self.k
        
        res = torch.where(x > self.k, part3, x)
        res = torch.where(x <= 0, part1, res)
        
        return res

class Model(nn.Module):
    def __init__(self, k_init=21.0):
        super(Model, self).__init__()
        self.act = SbPiPLU(k_init=k_init)
    
    def forward(self, x):
        return self.act(x)

def get_inputs():
    input_tensor = torch.randn(SHAPE, dtype=torch.float32) * 25.0
    return [input_tensor.contiguous()]

def get_init_inputs():
    return [K_INIT]